package com.ldodds.ot;

import java.util.Map;

/**
 * Describes objects that are annotated with properties. Each property 
 * held by the object is associated with it via two distinct keys: a simple 
 * unstructured label, and a URI (i.e. an RDF property URI). 
 * <p>
 * The annotations are exposed as two separate collections, each of which is keyed in an 
 * alternate way. I.e. the contents of each map exposed by this interface are identical, 
 * only the keys are different.
 * </p>
 * @author Leigh Dodds
 */
public interface PropertyHolder {

	/**
	 * Retrieve this resources properties, keyed under simple labels.
	 * 
	 * @return the Map of properties. May be empty.
	 */
	Map<String,Object> getProperties();

	/**
	 * Retrieve this resources properties, keyed under RDF property URIs
	 * 
	 * @return the Map of properties. May be empty.
	 */	
	Map<String, Object> getPropertiesByURI();

	/**
	 * Annotate this object with an extra property, specifying both the simple 
	 * key and the full property URI. The same simple key should be consistenyl 
	 * associated with a property URI.
	 *  
	 * @param uri the RDF property URI
	 * @param key a simple key for this property.
	 * @param value the value to store
	 */
	void put(String uri, String key, Object value);
		
	/**
	 * Determine if the object has a specific property. The method is equivalent 
	 * to accessing the predicate based map (getPropertiesByURI) and testing 
	 * for the presence of the provided URI as a key in that map.
	 * 
	 * @param propertyURI URI for the property
	 * @return true if the Resource holds this property
	 */
	boolean hasProperty(String propertyURI);
}
